package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.pojo.Dish;
import com.sky.result.Result;
import com.sky.service.user.UserDishService;
import com.sky.service.user.UserService;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;
import java.util.List;

@Slf4j
@Api("查询菜品")
@RestController
@RequestMapping("/user/dish")
public class UserDishController {
    @Autowired
    private UserDishService userDishService;
    @GetMapping("/list")
    @ApiOperation("根据分类id查询菜品")
    //前端你传过来一类菜品的id，我们根据一类菜品id查询这一类菜品的的所有菜品佳肴
    //如果直接查询category是查不出菜品佳肴的，所以要在dish表查询
    public Result<List<DishVO>> queryById(@PathParam("categoryId") Long categoryId){
        log.info("菜品的类型id为：{}",categoryId);
        List<DishVO> dishVo=userDishService.list(categoryId);
        return Result.success(dishVo);
    }


}
